<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
</head>
<body>
    <div id="app">
        <div v-for="item in userList">
            <user-component :id="item.id" :name="item.name" :photo="item.photo"></user-component>
        </div>
    </div>

    <template id="userDiv">
        <div style="float: left; margin: 5px; width: 200px; border:#abcdef solid 1px">
            <table width="100%">
                <tr>
                    <td>id</td>
                    <td>{{id}}</td>
                </tr>
                <tr>
                    <td>name</td>
                    <td>{{name}}</td>
                </tr>
                <tr>
                    <td>photo</td>
                    <td>
                        <img :src="'img/'+ photo" width="100" height="75" />
                    </td>
                </tr>
            </table>
        </div>
    </template>

    <script>
        var app = new Vue({
            el: "#app",
            data: {
                userList: [
                    {id:1, name:"张三",photo:"1.jpg"},
                    {id:2, name:"李四",photo:"2.jpg"},
                    {id:3, name:"王五",photo:"3.jpg"},
                ]
            },
            components: {
                "userComponent": {
                    template: "#userDiv",
                    props:['id', 'name', 'photo']
                }
            }
        });
    </script>

</body>
</html>